<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2020/4/21
 * Time: 11:01
 */

namespace app\common\model;


use think\Model;
use traits\model\SoftDelete;

class SalesCompany extends Model
{
    use SoftDelete;
    protected $table = 'sales_company';
    protected $deleteTime = 'delete_time';
    protected $hidden = ['delete_time'];

    public function getProvinceAttr($name){
        return $name?:'';
    }
    public function getCityAttr($name){
        return $name?:'';
    }
    public function getDistrictAttr($name){
        return $name?:'';
    }
    public function getAddressAttr($name){
        return $name?:'';
    }
    public function getUserNameAttr($name){
        return $name?:'';
    }
    public function getPhoneAttr($name){
        return $name?:'';
    }
    public function getCommonAttr($name){
        return $name?:'';
    }

    public function parent(){
        return $this->belongsTo('SalesCompany', 'parent_id', 'id')->field('id,company_name as parent_name')->bind('parent_name');
    }
}